<template>
    <div class="swiperTop">
        <van-swipe :autoplay="3000" lazy-render>
            <van-swipe-item v-for="image in store.state.banners" :key="image.bannerId
            ">
                <img class="img" :src="image.pic" />
            </van-swipe-item>
        </van-swipe>
    </div>
</template>

<script lang='ts' setup>
import store from '@/store';
import { onMounted } from 'vue'
onMounted(async () => {
    let res = await store.dispatch('getBanner')
    if (res.data.code === 200) {
        store.commit('updateBanners', res.data.banners)
    }
})
</script>
 
<style lang = "less" scoped>
.swiperTop {
    border-radius: 0.2rem;
    padding-top: 0.2rem;
}

.img {
    width: 100%;
    height: 3rem;
    border-radius: 0.2rem;
}
</style>